home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-20 | 1.4 KB | 60 lines | [TEXT/CWIE] |
- // SecureWindowRef.cp, the SecureWindowRef class, useful for generating windows
- // for those who do not use a framework to make windows for them.
-
- // copyright © 1995, Macneil Shonle. All rights reserved.
-
- #ifndef __SECUREWINDOWREF__
- #include <SecureWindowRef.h>
- #endif
-
- // constructs the window from the parameters
- // may throw: invalidargument
- SecureWindowRef::SecureWindowRef(const Rect& bounds, short theProc, ConstStr255Param title,
- Boolean goAwayFlag, Boolean visible, WindowRef behind, long refCon, void *wStorage)
- throw(invalidargument)
- : window(::NewCWindow(wStorage, &bounds, title, visible, theProc, behind,
- goAwayFlag, refCon))
- {
- if (window == nil)
- throw invalidargument("NewCWindow failed", "SecureWindowRef::SecureWindowRef");
- }
-
- SecureWindowRef::~SecureWindowRef()
- {
- ::DisposeWindow(window);
- }
-
- Rect& SecureWindowRef::portRect() const
- {
- return window->portRect;
- }
-
- BitMapPtr SecureWindowRef::bitMap() const
- {
- return &GrafPtr(window)->portBits;
- }
-
- short SecureWindowRef::width() const
- {
- return window->portRect.right - window->portRect.left;
- }
-
- short SecureWindowRef::height() const
- {
- return window->portRect.bottom - window->portRect.top;
- }
-
- CGrafPtr SecureWindowRef::getMacPort() const
- {
- return CGrafPtr(window);
- }
-
- GDHandle SecureWindowRef::getMacGD() const
- {
- return ::GetMainDevice();
- }
-
- SecureWindowRef::operator WindowRef() const
- {
- return window;
- }